package cn.hackcloud.javabase.singleton;

/**
 * 单列模式
 * 
 * @author hackcloud
 *
 */
public class TestSingleton {
	public static void main(String[] args) {
		Singleton singleton = Singleton.getInstance();
		Singleton singleton2 = Singleton.getInstance();
		System.err.println(singleton==singleton2);
	}
}

class Singleton {
	private Singleton() {
	}

	private static Singleton instacne = new Singleton();

	public static Singleton getInstance() {
		return instacne;
	}
}
